-- CALC_DUNGEON_MONSTER_INIT_ATTACK
-- 计算地牢BOSS的初始攻击

-------------------
-- @param attackCoef attack系数
-- @param layer      地牢层数
return function(attackCoef, layer, layer_fix)
    -- b + ax
    local att_b = 0.16 * layer_fix;
    local att_a = attackCoef * (60 + layer_fix) / 3500;
    local attack = 0;

    if layer < 25 then
        -- 在比较小层的情况下，精确计算
        local num = 5600 * layer_fix + (60 + layer_fix) * layer * math.modf(10 * attackCoef);
        local deno = 35000;

        local ret = math.modf(num / deno);
        if num % deno ~= 0 then
            ret = ret + 1;
        end

        return ret;
    elseif layer < 45 then
        attack = att_b + att_a * layer * layer / 25;
    elseif layer < 70 then
        attack = att_b + att_a * layer * layer / 25 * layer / 45;
    elseif layer < 80 then
        attack = att_b + att_a * layer * layer / 25 * layer / 45 * layer / 70;
    else
        attack = att_b + att_a * layer * layer / 25 * layer / 45 * layer / 70 * layer / 80;
    end

    -- 为保证服务器客户端计算一致，先做如此处理
    attack = tonumber(string.format("%.2f", attack));
    return math.modf(math.ceil(attack));
end
